import yaml # python3 -m pip install pyyaml


def wirte_yaml(yaml_file,data):
    with open(yaml_file, 'a+', encoding='utf-8') as f:
        yaml.dump(data, f,default_flow_style=False,allow_unicode=True)

def read_yaml(yaml_file,key):
    with open(yaml_file, 'r', encoding='utf-8') as f:
        all_values = yaml.load(f, Loader=yaml.FullLoader)
        return all_values[key]

def delete_yaml(yaml_file,key):
    with open(yaml_file, 'w', encoding='utf-8') as f:
        f.truncate()

def read_case(yaml_file):
    with open(yaml_file, 'r', encoding='utf-8') as f:
        all_values = yaml.load(f, Loader=yaml.FullLoader)
        return all_values